package IteratorAndComposite;

import IteratorAndComposite.IteratorInterfaces.Iterator;
import IteratorAndComposite.entry.DinerMenu;
import IteratorAndComposite.entry.MenuItem;

import java.util.Stack;

/**
 * @Author: pengzx
 * @Description:
 * @Date: 18:05 2017/9/20
 * @Modified by: 1.0
 */
public class Test {
    public static void main(String[] args){
        DinerMenu dinerMenu = new DinerMenu();
        printMune(dinerMenu.iterator());
    }

    public static void printMune(Iterator iterator){
        while (iterator.hasNext()){
            MenuItem menuItem = (MenuItem) iterator.next();
            System.out.println(menuItem.getName());
        }
    }

    @org.junit.Test
    public void test(){
        Stack<String> stack = new Stack<String>();
        stack.push("A");
        stack.push("B");
        stack.push("C");
        stack.push("D");

        java.util.Iterator<String> iterator = stack.iterator();
        while (iterator.hasNext()){
            System.out.println(stack.pop());
        }

    }
}
